<div class="dw_article_headers_list"><div class="dw_article_header_h1"><a href="#Indicator_calls_other_indicator/3_EMAs">3 EMAs</a></div><div class="dw_article_header_h1"><a href="#Indicator_calls_other_indicator/Signal_arrows_over_RSI"> Signal arrows over RSI </a></div></div><span id="Indicator_calls_other_indicator/3_EMAs"><h1>3 EMAs</h1></span>Sometimes it's needed to use another indicator results to implement a new indicator. Here we create an example indicator step by step, that outputs 3 EMA outputs in one shot.<br/><br/>1. Create new indicator from JForex. New editor will open with example indicator in it.<br/><br/>2. We will need <i>IIndicatorsProvider</i> from <i>IIndicatorContext</i> to get EMA indicator. <i>onStart</i> method is the good place to get it:<br/><div class="dw_article_geshi_code">IIndicatorsProvider indicatorsProvider <span style="color: #339933;">=</span> context.<span style="color: #006633;">getIndicatorsProvider</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />ema <span style="color: #339933;">=</span> indicatorsProvider.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>3. Now change info objects. Indicator will have one input, three parameters and three outputs:<br/><div class="dw_article_geshi_code">indicatorInfo <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> IndicatorInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;THREEEMA&quot;</span>, <span style="color: #0000ff;">&quot;Shows three different EMA indicators&quot;</span>, <span style="color: #0000ff;">&quot;My indicators&quot;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">true</span>, <span style="color: #000066; font-weight: bold;">false</span>, <span style="color: #000066; font-weight: bold;">true</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />inputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> InputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">new</span> InputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Input data&quot;</span>, InputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />optInputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Time period EMA1&quot;</span>, OptInputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">OTHER</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IntegerRangeDescription<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">1000</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Time period EMA2&quot;</span>, OptInputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">OTHER</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IntegerRangeDescription<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">1000</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Time period EMA3&quot;</span>, OptInputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">OTHER</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IntegerRangeDescription<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">20</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">1000</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />outputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA1&quot;</span>, OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo.<span style="color: #006633;">DrawingStyle</span>.<span style="color: #006633;">LINE</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA2&quot;</span>, OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo.<span style="color: #006633;">DrawingStyle</span>.<span style="color: #006633;">LINE</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA3&quot;</span>, OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo.<span style="color: #006633;">DrawingStyle</span>.<span style="color: #006633;">LINE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div>Also change holder fields for parameters and outputs. Add field to save ema indicator:<br/><div class="dw_article_geshi_code"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> timePeriod <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> outputs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">private</span> IIndicator ema<span style="color: #339933;">;</span></div>4. Lookback of the indicator should be biggest lookback of all three emas.<br/><div class="dw_article_geshi_code"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> ema1Lookback <span style="color: #339933;">=</span> ema.<span style="color: #006633;">getLookback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> ema2Lookback <span style="color: #339933;">=</span> ema.<span style="color: #006633;">getLookback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> ema3Lookback <span style="color: #339933;">=</span> ema.<span style="color: #006633;">getLookback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">max</span><span style="color: #009900;">&#40;</span>ema1Lookback, <span style="color: #003399;">Math</span>.<span style="color: #006633;">max</span><span style="color: #009900;">&#40;</span>ema2Lookback, ema3Lookback<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #009900;">&#125;</span></div>Also change method that saves time period parameters:<br/><div class="dw_article_geshi_code">timePeriod<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span> value<span style="color: #339933;">;</span></div>5. And finally write the calclulate method:<br/>First get the correct startIndex taking into account lookback<br/><div class="dw_article_geshi_code"><span style="color: #666666; font-style: italic;">//calculating startIndex taking into account lookback value</span><br /><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>startIndex <span style="color: #339933;">-</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; startIndex <span style="color: #339933;">-=</span> startIndex <span style="color: #339933;">-</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #009900;">&#125;</span></div>Set parameters to ema and calculate it's values:<br/><div class="dw_article_geshi_code">ema.<span style="color: #006633;">setInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, inputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp;<br /><span style="color: #666666; font-style: italic;">//calculate first ema</span><br />ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />ema.<span style="color: #006633;">setOutputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, outputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />ema.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp;<br /><span style="color: #666666; font-style: italic;">//calculate second ema</span><br />ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />ema.<span style="color: #006633;">setOutputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, outputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />ema.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp;<br /><span style="color: #666666; font-style: italic;">//calculate third ema</span><br />ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />ema.<span style="color: #006633;">setOutputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, outputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">return</span> ema.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div><i>IndicatorResult</i> returned from ema is also correct for main indicator, so we just return it after the last calculation.<br/><br/>Indicator is ready!<br/><div class="dw_article_geshi_code"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">jforex</span><span style="color: #339933;">;</span><br />&nbsp;<br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.*</span><span style="color: #339933;">;</span><br />&nbsp;<br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TripleEMAIndicator <span style="color: #000000; font-weight: bold;">implements</span> IIndicator <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> IndicatorInfo indicatorInfo<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> InputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> inputParameterInfos<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> OptInputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> optInputParameterInfos<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> OutputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> outputParameterInfos<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> inputs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> timePeriod <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> outputs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> IIndicator ema<span style="color: #339933;">;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onStart<span style="color: #009900;">&#40;</span>IIndicatorContext context<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IIndicatorsProvider indicatorsProvider <span style="color: #339933;">=</span> context.<span style="color: #006633;">getIndicatorsProvider</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema <span style="color: #339933;">=</span> indicatorsProvider.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; indicatorInfo <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> IndicatorInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;THREEEMA&quot;</span>, <span style="color: #0000ff;">&quot;Shows three different EMA indicators&quot;</span>, <span style="color: #0000ff;">&quot;My indicators&quot;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">true</span>, <span style="color: #000066; font-weight: bold;">false</span>, <span style="color: #000066; font-weight: bold;">true</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; inputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> InputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">new</span> InputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Input data&quot;</span>, InputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; optInputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Time period EMA1&quot;</span>, OptInputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">OTHER</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IntegerRangeDescription<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">1000</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Time period EMA2&quot;</span>, OptInputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">OTHER</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IntegerRangeDescription<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">1000</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Time period EMA3&quot;</span>, OptInputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">OTHER</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IntegerRangeDescription<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">20</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">1000</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; outputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA1&quot;</span>, OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo.<span style="color: #006633;">DrawingStyle</span>.<span style="color: #006633;">LINE</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA2&quot;</span>, OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo.<span style="color: #006633;">DrawingStyle</span>.<span style="color: #006633;">LINE</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA3&quot;</span>, OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo.<span style="color: #006633;">DrawingStyle</span>.<span style="color: #006633;">LINE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> IndicatorResult calculate<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> startIndex, <span style="color: #000066; font-weight: bold;">int</span> endIndex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//calculating startIndex taking into account lookback value</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>startIndex <span style="color: #339933;">-</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startIndex <span style="color: #339933;">-=</span> startIndex <span style="color: #339933;">-</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, inputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//calculate first ema</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOutputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, outputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//calculate second ema</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOutputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, outputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//calculate third ema</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOutputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, outputs<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> ema.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> IndicatorInfo getIndicatorInfo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> indicatorInfo<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> InputParameterInfo getInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index <span style="color: #339933;">&lt;=</span> inputParameterInfos.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> inputParameterInfos<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> ema1Lookback <span style="color: #339933;">=</span> ema.<span style="color: #006633;">getLookback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> ema2Lookback <span style="color: #339933;">=</span> ema.<span style="color: #006633;">getLookback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ema.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, timePeriod<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> ema3Lookback <span style="color: #339933;">=</span> ema.<span style="color: #006633;">getLookback</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">max</span><span style="color: #009900;">&#40;</span>ema1Lookback, <span style="color: #003399;">Math</span>.<span style="color: #006633;">max</span><span style="color: #009900;">&#40;</span>ema2Lookback, ema3Lookback<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getLookforward<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> OptInputParameterInfo getOptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index <span style="color: #339933;">&lt;=</span> optInputParameterInfos.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> optInputParameterInfos<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> OutputParameterInfo getOutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index <span style="color: #339933;">&lt;=</span> outputParameterInfos.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> outputParameterInfos<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setInputParameter<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index, <span style="color: #003399;">Object</span> array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; inputs<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> array<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setOptInputParameter<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index, <span style="color: #003399;">Object</span> value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; timePeriod<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span> value<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setOutputParameter<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index, <span style="color: #003399;">Object</span> array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; outputs<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> array<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><span style="color: #009900;">&#125;</span></div><span id="Indicator_calls_other_indicator/Signal_arrows_over_RSI"><h1> Signal arrows over RSI </h1></span>Consider an indicator which draws signal arrows:<br/><ul><li>Red, down arrow when RSI < 30.</li><li>Green, up arrow when RSI < 70.</li></ul><img src="https://www.dukascopy.com/wiki/files//RSI_signal.png" border="0" /><br/><div class="dw_article_geshi_code"><span style="color: #666666; font-style: italic;">/*<br />&nbsp;* Copyright 2009 Dukascopy?\u00ae (Suisse) SA. All rights reserved.<br />&nbsp;* DUKASCOPY PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.<br />&nbsp;*/</span><br /><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">jforex.indicators</span><span style="color: #339933;">;</span><br /><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Color</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.IIndicator</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.IIndicatorContext</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.IIndicatorsProvider</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.IndicatorInfo</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.IndicatorResult</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.InputParameterInfo</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.IntegerRangeDescription</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.OptInputParameterInfo</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.dukascopy.api.indicators.OutputParameterInfo</span><span style="color: #339933;">;</span><br /><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> com.<span style="color: #006633;">dukascopy</span>.<span style="color: #006633;">api</span>.<span style="color: #006633;">indicators</span>.<span style="color: #006633;">OutputParameterInfo</span>.<span style="color: #006633;">DrawingStyle</span>.<span style="color: #339933;">*;</span><br /><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> com.<span style="color: #006633;">dukascopy</span>.<span style="color: #006633;">api</span>.<span style="color: #006633;">indicators</span>.<span style="color: #006633;">OutputParameterInfo</span>.<span style="color: #006633;">Type</span>.<span style="color: #339933;">*;</span><br /><br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RSISinglaArrows <span style="color: #000000; font-weight: bold;">implements</span> IIndicator <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> IndicatorInfo indicatorInfo<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> InputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> inputParameterInfos<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> OptInputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> optInputParameterInfos<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> OutputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> outputParameterInfos<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Price includes 5 arrays: open, close, high, low, volume</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> inputsPriceArr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <br />&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//price array depending on AppliedPrice</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> inputsDouble <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> outputs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br /><br />&nbsp; &nbsp; IIndicator rsiIndicator<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> rsiTimePeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">14</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//output indices</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> DOWN <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> UP <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//input indices</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> HIGH <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> LOW <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onStart<span style="color: #009900;">&#40;</span>IIndicatorContext context<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; indicatorInfo <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> IndicatorInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RSI_Signals&quot;</span>, <span style="color: #0000ff;">&quot;RSI signals&quot;</span>, <span style="color: #0000ff;">&quot;Custom indicators&quot;</span>, <span style="color: #000066; font-weight: bold;">true</span>, <span style="color: #000066; font-weight: bold;">false</span>, <span style="color: #000066; font-weight: bold;">false</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; inputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> InputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> InputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Price arrays&quot;</span>, InputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">PRICE</span><span style="color: #009900;">&#41;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> InputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Price double&quot;</span>, InputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span><span style="color: #009900;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; optInputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">new</span> OptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Rsi time period&quot;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OptInputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">OTHER</span>, <span style="color: #000000; font-weight: bold;">new</span> IntegerRangeDescription<span style="color: #009900;">&#40;</span>rsiTimePeriod, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">200</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; outputParameterInfos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Maximums&quot;</span>, DOUBLE, ARROW_SYMBOL_DOWN<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#123;</span> setColor<span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">RED</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> OutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Minimums&quot;</span>, DOUBLE, ARROW_SYMBOL_UP<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#123;</span> setColor<span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">GREEN</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; IIndicatorsProvider indicatorsProvider <span style="color: #339933;">=</span> context.<span style="color: #006633;">getIndicatorsProvider</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; rsiIndicator <span style="color: #339933;">=</span> indicatorsProvider.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RSI&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> IndicatorResult calculate<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> startIndex, <span style="color: #000066; font-weight: bold;">int</span> endIndex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>startIndex <span style="color: #339933;">-</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startIndex <span style="color: #339933;">-=</span> startIndex <span style="color: #339933;">-</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// calculating rsi</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> rsiOutput <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span>endIndex <span style="color: #339933;">-</span> startIndex <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; rsiIndicator.<span style="color: #006633;">setInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, inputsDouble<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; rsiIndicator.<span style="color: #006633;">setOutputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, rsiOutput<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />&nbsp; &nbsp; &nbsp; &nbsp; rsiIndicator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> i, j<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> startIndex, j <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;=</span> endIndex<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span>, j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//place down signal on the high price of the corresponding bar</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outputs<span style="color: #009900;">&#91;</span>DOWN<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> rsiOutput<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">30</span> <span style="color: #339933;">?</span> inputsPriceArr<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>HIGH<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #003399;">Double</span>.<span style="color: #006633;">NaN</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//place up signal on the low price of the corresponding bar</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outputs<span style="color: #009900;">&#91;</span>UP<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> rsiOutput<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">70</span> <span style="color: #339933;">?</span> inputsPriceArr<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>LOW<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #003399;">Double</span>.<span style="color: #006633;">NaN</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> IndicatorResult<span style="color: #009900;">&#40;</span>startIndex, endIndex<span style="color: #339933;">-</span>startIndex <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> IndicatorInfo getIndicatorInfo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> indicatorInfo<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> InputParameterInfo getInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index <span style="color: #339933;">&lt;=</span> inputParameterInfos.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> inputParameterInfos<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getLookback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> rsiTimePeriod<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getLookforward<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> OptInputParameterInfo getOptInputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index <span style="color: #339933;">&lt;=</span> optInputParameterInfos.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> optInputParameterInfos<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> OutputParameterInfo getOutputParameterInfo<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index <span style="color: #339933;">&lt;=</span> outputParameterInfos.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> outputParameterInfos<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setInputParameter<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index, <span style="color: #003399;">Object</span> array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>index <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputsPriceArr<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> array<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>index <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputsDouble<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> array<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setOptInputParameter<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index, <span style="color: #003399;">Object</span> value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//set rsi time period</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rsiTimePeriod <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span> value<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rsiIndicator.<span style="color: #006633;">setOptInputParameter</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setOutputParameter<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> index, <span style="color: #003399;">Object</span> array<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; outputs<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> array<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><span style="color: #009900;">&#125;</span></div><a href="https://www.dukascopy.com/wiki/files//RSISinglaArrows.java">RSISinglaArrows.java</a><br/>